package com.kylin.commodity.api.web.facade;

import com.kylin.commodity.api.dto.req.NewCommodityReqDTO;
import com.kylin.commodity.api.dto.req.QueryCommodityReqDTO;
import com.kylin.commodity.api.dto.resp.CommentRespDTO;
import com.kylin.commodity.api.dto.resp.CommodityRespDTO;
import com.kylin.shared.common.Pagination;
import com.kylin.shared.common.ResponseWrapper;
import org.springframework.http.MediaType;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * 商品管理后台接口
 * @author Damon S.
 * @version v1.0.1
 * @date 2019年10月30日 16:06
 */
@RequestMapping(value = "/manage_v1/commodities", produces = MediaType.APPLICATION_JSON_VALUE)
public interface CommodityManageFacade {

    @PostMapping
    ResponseWrapper<Boolean> newCommodity(
            @RequestBody @Validated NewCommodityReqDTO newCommodityReqDTO
    );

    @GetMapping
    ResponseWrapper<Pagination<CommodityRespDTO>> findCommodities(
            @Validated QueryCommodityReqDTO queryCommodityReqDTO
    );


    @GetMapping("/{commodityId}")
    ResponseWrapper<CommodityRespDTO> findCommodityById(
            @PathVariable(value = "commodityId")Long commodityId
    );


    @GetMapping("/{commodityId}/comments")
    ResponseWrapper<Pagination<CommentRespDTO>> findCommentsByCommodityId(
            @PathVariable(value = "commodityId")Long commodityId
    );


    @PutMapping("/{commodityId}/pass")
    ResponseWrapper<Boolean> pass(
            @PathVariable(value = "commodityId")Long commodityId
    );


    @PutMapping("/{commodityId}/rejection")
    ResponseWrapper<Boolean> reject(
            @PathVariable(value = "commodityId")Long commodityId
    );
}
